#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<string>
#include<vector>
using namespace std;

class Solution {
public:
    int firstUniqChar(string s) {
        int hash[26] = { 0 };
        for (auto e : s) hash[e - 'a']++;
        for (int i = 0; i < s.size(); i++) {
            if (hash[s[i] - 'a'] == 1) return i;
        }
        return -1;
    }
};

class Solution {
public:
    int search(vector<int>& nums, int target) {
        int n = nums.size();
        int left = 0, right = n - 1;
        while (left < right)
        {
            int mid = (left + right) / 2;
            if (nums[mid] >= target) right = mid;
            else left = mid + 1;
        }
        if (nums[left] == target) return left;
        return -1;
    }
};